AM_CPPFLAGS = $(SLGLADE_CFLAGS) -I$(SLANG_INC)

## Specify installation dir for S-Lang modules
slmoddir = $(libdir)/slang/modules

slmod_LTLIBRARIES = glade-module.la
glade_module_la_SOURCES = module.c module.h slirptypes.h
glade_module_la_LDFLAGS = -no-undefined -module -avoid-version \
			  -R $(SLANG_LIB) -R $(SLGTK_MOD) \
			  -L$(SLANG_LIB) -L$(SLGTK_MOD) \
			  -lslang -lslgtk $(SLGLADE_LIBS)
EXTRA_DIST = init_load_string.c intrin_funcs.c slirptypes.c

## Add rules to prevent make from trying to compile init_load_string.c,
## intrin_funcs.c, and slirptypes.c by themselves

init_load_string.c:
	@echo "Nothing to do for $@, which is logically part of module.c"

intrin_funcs.c:
	@echo "Nothing to do for $@, which is logically part of module.c"

slirptypes.c:
	@echo "Nothing to do for $@, which is logically part of module.c"

## To run after all other installation commands:  If libtool named the shared
## object something other than "glade-module.so" (which S-Lang will look
## for), create a symbolic link with that name to the shared object

install-data-hook:
	@if test ! -f $(slmoddir)/glade-module.so; then \
	  echo "Creating glade-module.so symbolic link"; \
	  $(LN_S) \
	    `grep 'dlname=' $(slmoddir)/glade-module.la | awk -F\' '{ print $$2 }'` \
	    $(slmoddir)/glade-module.so; \
	fi

## Apparently the version of automake I'm using doesn't support this, but
## I'll leave it here for the future

uninstall-hook:
	rm -f $(slmoddir)/glade-module.so

